Menu

Wiki usage

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.
Edit Sidebar
Main > Areaportals

Area portal, tutorial

This tutorial will attempt to teach by example how to use the common/areaportal texture.

On this page...

Introduction

You know that the map V2 Facility has one of the best FPS:es among the maps shipped with MOH:AA... Not really that strange as there are a lot of corridors that does not show that much of the map at once, so there is not a lot to draw for the graphic engine. But there is another reason that the blazing FPS of the V2 Facility has been achieved as well... If you have a modest or bad computer: you may have noticed that FPS drops every time the doors to the V2 area is open... this is because the V2 area is not drawn when they are closed.

So? You say... naturally the things I cant see is not drawn!

Well, this is unfortunately not true. Especially when it comes to doors. But it can be true if you learn to use areaportals.

The problem

Consider these three rooms:

...the picture above shows three rooms. Two of them contains some complex brushes. One contains the player starting points and nothing more. The rooms are connected with short corridors. At both ends of the corridors, there are doors.

Normally every brush in this little map will be drawn all the time.

If you doubt me, soon is the time for you to look like this: (o_0) ...and yell Eureka!

The doors to the room with the sphere has no area portals, the doors to the room with the twelve cones does contain area portals. Now lets look at the rooms from the middle room using the r_showtris 2 command ( if you don't know this command, learn about it here? ).

The two doors without areaportals:

With both doors open:

With the farthest door closed:

With both doors closed:

...as you can see: The contents of the room is draw even if there are two closed doors in the way. If this is news to you, make this face now: (o_0)

Now the two doors with areaportals: With both doors open:

With the farthest door closed:

With both doors closed:

...this is what I expect many of you thought happened all the time a door closed. But not without some area portals and some conscious architectural decisions.

How area portals work

Area portals work together with structural brushes ( if you don't know what a structural brush is, read "Vis for Dummies" ) to create a closed section in the map: a separate area. When an area is closed, it is not drawn if you are outside that area And if you are inside a closed area, nothing outside it is drawn. To close an area, you need it to be totally sealed off from the rest of the map with a combination of area portals and structural brushes.

How area portals don't work

To create a separate area, it must be sealed. No translucent brushes ( like windows and water) and no fence textures ( like iron gates or fences ) and no entities ( other than doors ) can be part of the sealing off of the area.

How to insert area portals in your map

If you have a func_rotatingdoor entity like this ( door selected in red ):

...place a brush with the common/areaportal texture like this ( area portal selected i red ):

... so that is sticks out into the ( structural ) wall a few units. It should be:

Here is how it should look in MOHRadiant ( You can't see the area portal brush ):

...and here is the same view with the View->Filter->Entities activated ( a func_rotatingdoor is an entity ):

That's it!

Controlling area portals manually

Sooner or later you will for some reason want to manually activate and deactivate an area portal instead of doing it "automagically" with a door. An example of this is when you create a hatch in the floor/ceiling that turns up or down by executing a move command on a script_object entity in the script of the map, like this:

 $hatch rotateXup 90

In this case you will have to deactivate the area portal manually once the hatch starts to open, and activate it once it has been closed again. This is done with these two simple commands:

 $my_hatch closeportal // Closes the area portal and seals the area

and

 $my_hatch openportal // Opens the area portal, exposing the area

Observe that you are NOT giving the openportal and closeportal commands to the area portal itself. You actually give it to an entity that touches the area portal. The example *.map file in the next section contains a scripted hatch that controls an area portal manually.

Download the example *.map file here

Here is the link to download the example *.map file used in this tutorial: Attach:areaportal_tutorial.zip

End

This concludes this tutorial. Time to yell EUREKA

EUREKA!

- Bjarne

Recent Changes Printable View Page History Edit Page [Attributes] [Printable View] [WikiHelp]
Page last modified on February 04, 2005, at 02:00 AM